<template>
  <div id="jing-pin">
    <div class="jp-bg">
      <img :src="`${baseURL}/jd_card/index/sellwell5/3.jpg`" alt="" />
    </div>
    <div class="jp-title">
      <p class="p-top">热卖心选</p>
      <p class="p-sub">春节拜年必备 传递情谊合心意</p>
      <div class="more" @click="goMore">更多</div>
    </div>
    <div class="jp-scroll">
        <van-image
          class="pic"
          :src="`${baseURL}/jd_card/index/sellwell5/1.jpg`"
          alt=""
        />
        <van-image
          class="pic"
          :src="`${baseURL}/jd_card/index/sellwell5/2.jpg`"
          alt=""
        />
    </div>
    <div class="jp-content">
      <div class="jp-card" v-for="(item, i) of arr0" :key="i" @click="gopro(item.gid)">
          <div class="jp-card-left">
            <van-image
              :src="`${baseURL}/jd_card/goods/${item.gpic}`"
              alt=""
            />
          </div>
          <div class="jp-card-right">
            <p class="card-brand">热卖top</p>
            <p class="card-title">{{item.gtitle }}</p>
            <p class="card-price">￥{{item.gprice}}</p>
          </div>
        <div style='position:relative'>
          <lpk-zjjg :item="item"></lpk-zjjg>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      jingpindata: {
        0: { image: "1.jpg", herf: "#1" },
        1: { image: "2.jpg", herf: "#2" },
      },
      arr0:[],
    };
  },
  methods: {
    update(i){
      console.log(i);
      this.arr0=i;
    },
    goMore() {
      this.$router.push(`/sort`);
    },
    gopro(gid) {
      this.$router.push({
        path: "/products",
        query: {
          gid,
        },
      });
    },
  },
};
</script>
<style lang="scss" scoped>
#jing-pin {
  position: relative;
  background-color: #f5f5f5;
  padding-bottom: 0.625rem;
  .jp-bg {
    img {
      display: block;
      width: 100%;
      border-radius: 0 .3125rem 0;
      margin-top: 1.5rem;
    }
  }
  .jp-title {
    position: relative;
    bottom: 9.375rem;
    color: white;
    padding-left: .84375rem;
    &::before {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      width: .25rem;
      height: 2.78125rem;
      background-color: #fff;
    }
    .p-top {
      margin: 0 0 .46875rem 0;
      font-size: 1rem;
    }
    .p-sub {
      margin: 0;
      font-size: .75rem;
    }
    .more {
      position: absolute;
      top: 0;
      right: 0;
      width: 4.625rem;
      line-height: 1.5rem;
      background: -webkit-linear-gradient(
        left,
        rgba(255, 255, 255, 0.6),
        rgba(255, 255, 255, 0)
      );
      border-top-left-radius: 1.875rem;
      border-bottom-left-radius: 1.875rem;
      text-align: center;
      font-size: .875rem;
      color: #000;
      &:after {
        content: "";
        display: inline-block;
        width: .3125rem;
        height: .5625rem;
        background: url("http://47.98.224.84:3000/jd_card/tubiao/load.png") no-repeat;
        background-size: 100% 100%;
        margin-left: .375rem;
      }
    }
  }
  .jp-scroll {
    display: flex;
    width: 100%;
    overflow: hidden;
    overflow-x: scroll;
    font-size: 0;
    margin-top: .3125rem;
    position: absolute;
    text-align: center;
    white-space: nowrap;
    top: 6rem;
    justify-content: center;
    .pic {
      width: 8.75rem;
      margin-left: .625rem;
      border-radius: 0.3125rem;
    }
    .pic:last-child {
      margin-right: .625rem;
    }
  }
  .jp-content {
    padding: 0.625rem 0.625rem 0;
    .jp-card {
      width: 100%;
      height: 8.75rem;
      border-radius: 0.3125rem;
      background-color: white;
      margin-bottom: 0.3125rem;
      position: relative;
      display: flex;
      .jp-card-left {
        width: 8.75rem;
        height: 8.75rem;
          img {
            width: 8.125rem;
            margin: 0.3125rem;
          }
      }
      .jp-card-right {
        flex: 1;
        padding: 1.25rem 1.875rem 1.25rem 0.9375rem;
        .card-brand {
            display: inline-block;
            margin: 0;
            padding: 0 0.3125rem;
            font-size: 0.6875rem;
            color: #f22e30;
            line-height: 1.1875rem;
            background-color: #feeaea;
        }
        .card-title {
            margin: 0.625rem 0 0.9375rem;
            font-size: 0.8125rem;
            line-height: 1.3125rem;
            font-weight: 500;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            color: #151517;
            white-space: normal;
        }
        .card-price {
            margin: 0 0 0.3125rem 0;
            text-align: left;
            color: #ec3838;
        }
      }
    }

  }
}

</style>